Repository navigation
Conversation
The WordPress AI plugin's AI Workspace never offers the model a tool that writes, so create-sequence is not reachable from it. A write there goes through a proposal kind instead: the model calls the kind's propose ability, the person sees the stored values on a card, and the kind writes them on approval. Adds a `workflow` proposal kind and its `vip-workflows/propose-sequence` ability. Proposed stages pass validate-sequence when they are stored, and approval creates the sequence through create-sequence as a draft, with manage_options re-checked at approval. Both are registered only while the AI plugin's Proposal_Kind interface exists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Lets the WordPress AI plugin's AI Workspace design an editorial workflow that a person approves before it exists. The AI Workspace never offers the model a tool that writes, so
create-sequencecan't be reached from it. A write there goes through a proposal kind instead: the model calls the kind's propose ability, the person sees the stored values on an approval card, and the kind writes them once they approve. This adds that kind for sequences.It pairs with WordPress/ai#1004 (AI Workspace, landing in WordPress AI 1.6.0). It needs no change in the AI plugin: a create kind with no card of its own renders as the AI plugin's generic create card.
Spec changes
vip-workflows/propose-sequence(manage_options, re-checked at approval; not in REST or MCP).create_item(), which this feature relies on.includes/ai-workspace/files.What was done
A
workflowproposal kind (includes/ai-workspace/class-sequence-proposal.php)SequenceProposalimplements the AI plugin'sProposal_Kindinterface directly, without extending its internalProposal_Writerbase.max_items1), only creates (is_updatefalse), and takes no edits on the card (accepts_editsfalse).normalize_item()requires a name, stages and at least one registered post type. It runs the stages throughvalidate-sequence, the same dry run of the write gate the sequence editor andcreate-sequenceuse, so the card never shows a sequence that can't be saved. Stages and post types are stored as JSON, because the AI plugin stores a kind's fields as strings.present_item()gives the name,post_type: workflow,status: draft, the description, and the stages in order (Pitch → Draft → Edit → Legal review → Ready to publish). The button then reads "Create 1 draft".write()re-checksmanage_options, then creates the sequence throughcreate-sequencewithstatus: draft. It reports every outcome count, calls$on_itemfor each item, and links toadmin.php?page=vip-workflows-sequences#/edit/{id}.A propose ability (
includes/ai-workspace/class-propose-sequence.php)vip-workflows/propose-sequencestores the proposal and writes nothing.readonly: false,show_in_rest: false,mcp.public: false, the same as the AI plugin's own propose abilities.create-sequence's input schema, so the two can't drift.A module that is idle without the AI plugin (
includes/ai-workspace/class-ai-workspace.php)AIWorkspaceadds the kind onwpai_workspace_proposal_kindsand registers the ability onwp_abilities_api_initat priority 11, aftercreate-sequence.interface_exists( Proposal_Kind )first, so without the AI plugin nothing loads.Plugin::init_components().Tests
tests/phpunit/Integration/AIWorkspaceSequenceProposalTest.phphas 9 tests against the real write path: kind metadata, field stripping, refusal of an invalid graph and of missing fields, the card fields, a draft created with every count reported, a deselected item, and capability revoked between proposing and approving.tests/phpunit/stubs/ai-workspace.phpcopies the AI plugin'sProposal_Kindsignatures for the test environment, which doesn't load the AI plugin.CopyStandardTestexempts the three strings written for the model, matching how ability strings underabilities/are already exempt.How to test
cd vip-workflows && composer test: the unit suite passes.npm run test:php:integration: the integration suite passes. Ran locally: 627 tests OK, including the 9 new ones.feat/ai-workspacebranch active and the AI Workspace experiment on:Verified locally against WordPress/ai at
58323606, driven by a script rather than a live model:created: 1, and the row is stored withstatus=draft.Follow-ups
_wpai_workspace_proposal_item), and sequences aren't posts. Protection against writing twice therefore relies on the AI plugin claiming the proposal and marking it executed, andduplicateis always 0. If the stored proposal expired and the same proposal ran again, it would create a second draft.log_operation()names the operation but nothing records it.create_item()inserts the sequence asactiveand then setsdraftin a second write. Making that one write would close the footgun above.AI assistance: Yes. Tool(s): Claude Code (Claude Opus 5.5). Used for: implementing the proposal kind, the ability and the module, writing the integration tests and the SPEC.md changes, and running the local verification described above.
🤖 Generated with Claude Code